package com.baizhi.action;

import com.baizhi.entity.City;
import com.baizhi.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@Scope("prototype")
public class CityAction {
    private CityService cityService;
    @Autowired
    public void setCityService(CityService cityService) {
        this.cityService = cityService;
    }
    private Map<String,Object> map = new HashMap<>();

    public Map<String, Object> getMap() {
        return map;
    }

    public void setMap(Map<String, Object> map) {
        this.map = map;
    }
    private String provinceid;

    public String getProvinceid() {
        return provinceid;
    }

    public void setProvinceid(String provinceid) {
        this.provinceid = provinceid;
    }

    public String showCitys(){
        System.out.println(2222);
        List<City> cities = cityService.selectByProvinceid(provinceid);
        map.put("list",cities);
        return "ok";
    }
}
